-
Notifications
You must be signed in to change notification settings - Fork 49
Fix driver behavior on TruncateError handling - stop retrying on permanent failures #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@copilot - please complete the work here. |
Co-authored-by: mykaul <4655593+mykaul@users.noreply.github.com>
Co-authored-by: mykaul <4655593+mykaul@users.noreply.github.com>
… test comment Co-authored-by: mykaul <4655593+mykaul@users.noreply.github.com>
Work completed! The issue has been fixed in commit 9222b2e. Summary of changes:
The driver now correctly handles TruncateError as a permanent failure that should not be retried. |
| if self._metrics is not None: | ||
| self._metrics.on_other_error() | ||
| cl = getattr(self.message, 'consistency_level', None) | ||
| retry = retry_policy.on_request_error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - the code could have been more readable if you kept the TruncateError in line 4479, and here just did and if isntance(response, TruncateError): and then lines 4792-4793. Please fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored for better readability in commit 77d5c57. TruncateError is now kept in the error tuple on line 4779, with a specific check inside the block to handle it differently (no retry). This reduces duplication and makes the code flow clearer.
Keep TruncateError in the error tuple but check for it specifically within the block to avoid retry logic. This makes it clearer that TruncateError is similar to other request errors but requires different handling. Co-authored-by: mykaul <4655593+mykaul@users.noreply.github.com>
Description
This PR fixes the issue where the Python driver incorrectly retries
TRUNCATE_ERROR(0x1003), which should not be retried as it indicates a permanent failure rather than a transient error.Problem
TruncateErrorwas grouped with transient errors (OverloadedErrorMessage,IsBootstrappingErrorMessage,ServerError) that triggerretry_policy.on_request_error()RETRY_NEXT_HOST, causing unnecessary retries on other hostsSolution
TruncateErrorin the error tuple with similar request errors for better code organizationTruncateErrorTruncateErrornow immediately rethrows without retry, sharing logging and metrics code with other request errorsTruncateErroris not retriedNote: Investigation confirmed that server error messages are already properly included in
TruncateErrorexceptions via the baseErrorMessageclass's__str__method, so no changes were needed for that aspect.Changes Made
TruncateErrorhandling for better readability while preventing retry logicTruncateErrorremains in the error tuple (line 4779) to show its relationship to other request errorsTruncateErrorTruncateErrorTruncateErrormessage handling and error code verificationTesting
TruncateErrorbehaviorTruncateErrorno longer triggers retriesPre-review checklist
./docs/source/.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.